package com.demo2do.fms.entity.vehicle.tractor;

import org.apache.commons.lang3.StringUtils;

import com.demo2do.core.utils.Alias;

/**
 * 车辆所属权
 * 
 * @author Wy
 */
@Alias("CarOwnership")
public enum CarOwnership {
    
    /** 自有  */
    OWN("01","own", "自有"),
    
    /** 控股  */
    HOLDING("02","holding", "控股"),
    
    /** 未转籍 */
    NOTCONVERTED("03","notConverted", "未转籍"),
    
    /** 租赁 */
    LEASE("04","lease", "租赁"),
    
    /** 个人挂靠  */
    PERSONALANCHORS("05","personalAnchors", "个人挂靠"),
    
    /** 公司挂靠*/
    COMPANYANCHORS("06","companyAnchors ", "公司挂靠");
    
    private String code;
    
    private String alias;
    
    private String description;

    private CarOwnership(String code, String alias , String description) {
        
        this.code = code;
        
        this.alias = alias;

        this.description = description;

    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static CarOwnership aliasOf(String alias){
        
        for(CarOwnership auditStatus : CarOwnership.values()){
            if(auditStatus.getAlias().equals(alias)){
                
                return auditStatus;
            }
        }
        return null;
    }
    
    /**
     * @param description
     * @return
     */
    public static CarOwnership descriptionOf(String description){
        
        for(CarOwnership auditStatus : CarOwnership.values()){
            if(StringUtils.equals(auditStatus.getDescription(), description)) {
                return auditStatus;
            }
        }
        return null;
    }
    
    /**
     * 
     * @return code
     */
    public String getCode() {
        return code;
    }
    /**
     * 
     * @return  alias
     */
    public String getAlias() {
        return alias;
    }
    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

}
